let express = require('express')
let app = express()
let bodyParser = require('body-parser')

let mongoose = require('./DBconfig/mongoose')
let db = mongoose()

app.use(bodyParser.urlencoded({ extended: false }))
app.use(bodyParser.json())

// 跨域设置
app.all('*', function (req, res, next) {
  res.header('Access-Control-Allow-Origin', '*');
  //Access-Control-Allow-Headers ,可根据浏览器的F12查看,把对应的粘贴在这里就行
  res.header('Access-Control-Allow-Headers', 'Content-Type');
  res.header('Access-Control-Allow-Methods', '*');
  res.header('Content-Type', 'application/json;charset=utf-8');
  next();
});

app.use(express.static('deployDir'))


app.use('/login', require('./router/login'))
app.use('/register', require('./router/register'))

app.use('/project', require('./router/project'))
app.use('/errorReport', require('./router/errorReport'))



// // 填写考核
// app.use('/addCheck', require('./router/addCheck'))
// // 查询考核
// app.use('/queryCheck', require('./router/queryCheck'))
// 显示会议人员
// app.use('/showDetail', require('./router/showDetail'))
// // 重置会议人员
// app.use('/resetDetail', require('./router/resetDetail'))
// // 个人考核
// app.use('/queryPsgCheck', require('./router/queryPsgCheck'))
// // 获取访问者 ip地址
// app.use('/queryClientIP', require('./router/queryClientIP'))
// // 员工信息填写
// app.use('/userInfo', require('./router/userInfo'))

// // 部署系统
// app.use('/deployment', require('./router/deployment'))
// app.use('/TCdownLoad', require('./router/TCdownLoad'))

app.listen(8092, () => {
  console.log('server run http://localhost:8092')
})
